﻿using BCEntity.TMS.AgentWallet;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace BCData.TMS.AgentWallet
{
    public interface IAgentWalletData
    {
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        AgentWalletEntity Add(AgentWalletEntity entity);
        /// <summary>
        /// 余额充值
        /// </summary>
        /// <param name="agentRecordId"></param>
        /// <param name="rechargeAmount"></param>
        /// <returns></returns>
        AgentWalletEntity BalanceRecharge(long agentRecordId, decimal rechargeAmount);
        /// <summary>
        /// 修改ali认证
        /// </summary>
        /// <param name="agentRecordId"></param>
        /// <param name="aliPayAuthInfo"></param>
        /// <returns></returns>
        int ChangeAliPayAuthInfo(long agentRecordId, string aliPayAuthInfo);
        /// <summary>
        /// 修改微信认证
        /// </summary>
        /// <param name="agentRecordId"></param>
        /// <param name="wxPayAuthInfo"></param>
        /// <returns></returns>
        int ChangeWxPayAuthInfo(long agentRecordId, string wxPayAuthInfo);
        /// <summary>
        /// 清除密码错误次数
        /// </summary>
        void ClearErrorCount();
        /// <summary>
        /// 获取钱包
        /// </summary>
        /// <param name="agentWalletId"></param>
        /// <returns></returns>
        AgentWalletEntity Get(long agentWalletId);
        /// <summary>
        /// 获取红包
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="agentRecordId"></param>
        /// <returns></returns>
        (IEnumerable<AgentWalletEntity>, int) GetPageableList(int pageIndex, int pageSize, long? agentRecordId);
        /// <summary>
        /// 根据代理商id获取钱包
        /// </summary>
        /// <param name="agentRecordId"></param>
        /// <returns></returns>
        AgentWalletEntity GetWalletByAgentRecordId(long agentRecordId);
        /// <summary>
        /// 重置支付密码
        /// </summary>
        /// <param name="agentRecordId"></param>
        /// <param name="payPwd"></param>
        /// <returns></returns>
        AgentWalletEntity ResetPayPassword(long agentRecordId, string payPwd);
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        AgentWalletEntity Update(AgentWalletEntity entity);
        /// <summary>
        /// 自动服务费(不用)
        /// </summary>
        /// <param name="agentRecordId"></param>
        /// <returns></returns>
        Task<bool> UpdateIsOpenOffsetServiceFeeByAgentRecordIdAsync(long agentRecordId);
        /// <summary>
        /// 开启自动服务扣费
        /// </summary>
        /// <param name="agentWalletId"></param>
        /// <param name="isOpenOffsetServiceFee"></param>
        /// <returns></returns>
        Task<AgentWalletEntity> UpdateIsOpenOffsetServiceFeeByAgentWalletIdAsync(long agentWalletId, bool isOpenOffsetServiceFee);
        /// <summary>
        /// 修改错误次数
        /// </summary>
        /// <param name="agentRecordId"></param>
        /// <param name="passwordErrorCount"></param>
        /// <returns></returns>
        Task<AgentWalletEntity> UpdatePasswordErrorCount(long agentRecordId, int passwordErrorCount);

        /// <summary>
        /// 修改余额
        /// </summary>
        /// <param name="agentWalletId">红包id</param>
        /// <param name="amount">金额</param>
        /// <returns></returns>
        AgentWalletEntity UpdateBalance(long agentWalletId, decimal amount);
    }
}